/*
 * @Author: wangyuyong
 * @Date: 2020-07-19 10:51:54
 * @LastEditTime: 2020-07-22 12:58:34
 * @FilePath: /blog-manager/src/router/index.js
 * @Description:
 */

import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/home",
    name: "Home",
    component: Home,
    children: [
      {
        path: "",
        redirect: "writeBlog",
      },
      {
        path: "writeBlog",
        name: "WriteBlogPage",
        component: () => import("../views/WriteBlogPage.vue"),
      },
    ],
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/Login.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
